package controllcivil.primaryKey;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Embeddable
public class ConsumoPK implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -4749045877942274643L;


	private int material;
	
	
	@Column(name = "data_consumo")
	@Temporal(TemporalType.DATE)
	private Calendar dataConsumo;
	

		
	public ConsumoPK() {
	
	}

	public Calendar getDataConsumo() {
		return dataConsumo;
	}

	public void setDataConsumo(Calendar dataConsumo) {
		this.dataConsumo = dataConsumo;
	}

	public int getMaterial() {
		return material;
	}

	public void setMaterial(int material) {
		this.material = material;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((dataConsumo == null) ? 0 : dataConsumo.hashCode());
		result = prime * result + material;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ConsumoPK other = (ConsumoPK) obj;
		if (dataConsumo == null) {
			if (other.dataConsumo != null)
				return false;
		} else if (!dataConsumo.equals(other.dataConsumo))
			return false;
		if (material != other.material)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "ConsumoPK [dataConsumo=" + dataConsumo + ", material="
				+ material + "]";
	}
	
	

}
